home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / 422mods.zip / TW08.422 < prev    next >
Text File  |  1993-03-20  |  8KB  |  316 lines

  1. TW08.MOD -- Extended automessage mod for 4.xx? 4.22 at least
  2. The Warlord #1 @17306
  3. Sat Mar 13 19:55:54 1993
  4. 5To7: 1Everyone
  5. ┌────────────────────────────────────────────────────────────────────────────┐
  6. │ Mod Name: TW08.MOD                Mod Author: The Warlord                  │
  7. │ Difficulty: ▒░░░░░░░░░            Date: 03/13/93                           │
  8. │ WWIV Version: 4.22 (others, too)                                           │
  9. │ Files Affected: MISCCMD.C, FCNS.H                                          │
  10. │ Description: This is an extended auto-message mod, see features below.     │
  11. └────────────────────────────────────────────────────────────────────────────┘
  12.  
  13. ─ Features ─
  14. ■ 10 lines, instead of only 3
  15. ■ 70 characters per line, instead of only 39
  16. ■ Pretty colors all over :)
  17. ■ You can use colors in the automessage
  18. ■ Sysop or automessage author can delete the automessage
  19. ■ /S ends automessage, if it's not 10 lines long.
  20. ■ /ABT aborts the automessage
  21.  
  22. [ Step 1 ]: Back up your source! This is always a good idea.. There could be
  23.             a little cockroach or two in this mod somewhere. :)
  24.  
  25.             Example backup command line:
  26.             pkzip -ex -u source.zip *.c *.h *.mak
  27.  
  28.  
  29. [ Step 2 ]: Load up MISCCMD.C, and delete the functions:
  30.             void read_automessage()
  31.             void write_automessage1()
  32.             void write_automessage()
  33.             Block copy the following 3 functions in their place:
  34.  
  35. void read_automessage()
  36. {
  37.   int i,i1,i2,i3,f,len,ptrbeg[10],ptrend[10],temp;
  38.   char s[81],l[11][81],anon,buf[512];
  39.   slrec ss;
  40.  
  41.   temp=curatr;
  42.   sprintf(s,"%sAUTO.MSG",syscfg.gfilesdir);
  43.   f=open(s,O_RDWR | O_BINARY);
  44.   nl();
  45.   anon=status.amsganon;
  46.   if (f<1) {
  47.     nl();
  48.     title("No Auto-Message!");
  49.     nl();
  50.   } else {
  51.     len=read(f,(void *)buf,512);
  52.     close(f);
  53.     for (i=0; i<10; i++) {
  54.       ptrbeg[i]=0;
  55.       ptrend[i]=0;
  56.     }
  57.     i=0;
  58.     i1=0;
  59.     i2=0;
  60.     for(i=0; i<len; i++) {
  61.       if (i1) {
  62.         if (buf[i]==10) {
  63.           ptrbeg[i2]=i+1;
  64.           i1=0;
  65.         }
  66.       } else {
  67.         if (buf[i]==13) {
  68.           ptrend[i2]=i-1;
  69.           if (i2<11) {
  70.             for (i3=ptrbeg[i2]; i3<=ptrend[i2]; i3++)
  71.               l[i2][i3-ptrbeg[i2]]=buf[i3];
  72.               l[i2][ptrend[i2]-ptrbeg[i2]+1]=0;
  73.           }
  74.           ++i2;
  75.           i1=1;
  76.         }
  77.       }
  78.     }
  79.     ss=syscfg.sl[actsl];
  80.     if (anon)
  81.       if (ss.ability & ability_read_post_anony)
  82.         sprintf(s,"7───══ 5%s 7══───",&(l[0][0]));
  83.       else
  84.         strcpy(s,"7───══ 5UNKNOWN 7══───");
  85.     else
  86.       strcpy(s,&(l[0][0]));
  87.     nl();
  88.     if (okansi()) {
  89.       npr("\x1b[1;37;40m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄\r\n\x1b[47m \x1b[0;34;47mAutomessage By 7 %s\x1b[40m\r\n",s);
  90.       npr("\x1b[47m\x1b[1;30;40m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\r\n0");
  91.     }
  92.     else
  93.       npr("Automessage By: %s\r\n", s);
  94.     nl();
  95.     i=1;
  96.     while ((ptrend[i]) && (i<11)) {
  97.       pl(&(l[i][0]));
  98.       ++i;
  99.     }
  100.     nl();
  101.   }
  102.   curatr=temp;
  103. }
  104.  
  105. void write_automessage1()
  106. {
  107.   int i,i1,i2=0,f;
  108.   char s[81],l[11][81],g[81];
  109.   slrec ss;
  110.  
  111.   nl();
  112.   npr("5Enter auto-message now, max 710 5lines.\r\n");
  113.   npr("5Enter 2/S 5on a blank line to end.\r\n");
  114.   nl();
  115.   s[0]=0;
  116.   for (i=0; i<10; i++) {
  117.     npr("7[5%2d7] ",i+1);
  118.     sb(70,7);
  119.     inli(&(l[i][0]),s,70,1);
  120.     if (stricmp(&(l[i][0]),"/s")==0) {
  121.       l[i][0]=0;
  122.       i2=i;
  123.       break;
  124.     }
  125.     sprintf(g,"1");
  126.     strcat(g,&(l[i][0]));
  127.     strcat(g,"\r\n");
  128.     strcpy(&(l[i][0]),g);
  129.   }
  130.   if (!i2)
  131.     i2=10;
  132.   nl();
  133.   ss=syscfg.sl[actsl];
  134.   if (ss.ability & ability_post_anony) {
  135.     prt(5,"Anonymous? ");
  136.     if (yn())
  137.       i1=anony_sender;
  138.     else
  139.       i1=0;
  140.   }
  141.   i1=0;
  142.   prt(5,"Is this OK? ");
  143.   if (yn()) {
  144.     status.amsganon=i1;
  145.     status.amsguser=usernum;
  146.     save_status();
  147.     sprintf(s,"%sAUTO.MSG",syscfg.gfilesdir);
  148.     f=open(s,O_RDWR | O_BINARY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
  149.     strcpy(s,nam(&thisuser,usernum));
  150.     strcat(s,"\r\n");
  151.     write(f,(void *)s,strlen(s));
  152.     for (i=0; i<i2; i++)
  153.       write(f,(void *)&(l[i][0]),strlen(&(l[i][0])));
  154.     sysoplog("5Changed Auto-Message.");
  155.     nl();
  156.     pl("7Auto-message saved.");
  157.     nl();
  158.     close(f);
  159.   }
  160. }
  161.  
  162. void write_automessage()
  163. {
  164.   char ch, s[81];
  165.   int done,okwrite;
  166.   slrec ss;
  167.  
  168.   ss=syscfg.sl[actsl];
  169.   if (ss.posts)
  170.     okwrite=1;
  171.   else
  172.     okwrite=0;
  173.   if (thisuser.restrict & restrict_automessage)
  174.     okwrite=0;
  175.   done=0;
  176.   do {
  177.     cls();
  178.     pl("7Auto-Message:");
  179.     nl();
  180.     pl("7[2R7] 1Read auto-message");
  181.     pl("7[2W7] 1Write auto-message");
  182.     pl("7[2A7] 1Auto-reply to auto-message");
  183.     if (so()) {
  184.       pl("7[2D7] 1Delete auto-message");
  185.       pl("7[2Q7] 1Quit");
  186.       nl();
  187.       npr("5Choice: ");
  188.       sb(1,7);
  189.       ch=onek("QDRAW");
  190.     }
  191.     else {
  192.       pl("7[2Q7] 1Quit");
  193.       nl();
  194.       npr("5Choice: ");
  195.       sb(1,7);
  196.       ch=onek("QRAW");
  197.     }
  198.     switch(ch) {
  199.       case 'Q':
  200.         done=1;
  201.         break;
  202.       case 'R':
  203.         read_automessage();
  204.         pausescr();
  205.         break;
  206.       case 'W':
  207.         if (!okwrite)
  208.           npr("6Sorry, you can't change the automessage.\r\n");
  209.         else
  210.           write_automessage1();
  211.         pausescr();
  212.         break;
  213.       case 'D':
  214.         sprintf(s,"%sAUTO.MSG",syscfg.gfilesdir);
  215.         if (exist(s)) {
  216.           cls();
  217.           read_automessage();
  218.           nl();
  219.           npr("5Delete auto-message? ");
  220.           if (yn()) {
  221.             status.amsguser=0;
  222.             status.amsganon=0;
  223.             unlink(s);
  224.             pl("6Deleted!");
  225.             sysoplog("   2Deleted the auto-message.");
  226.           }
  227.         }
  228.         else
  229.           pl("6There's no auto-message to delete!");
  230.         pausescr();
  231.         break;
  232.       case 'A':
  233.         if (status.amsguser)
  234.           email(status.amsguser,0,0,status.amsganon);
  235.         break;
  236.     }
  237.   } while ((!done) && (!hangup));
  238. }
  239.  
  240.  
  241. [ Step 3 ]: Now page go down to the bottom of the file (MISCCMD.C), and
  242.             block copy these functions in.. Note: make sure you don't
  243.             already have these functions.. search through FCNS.H for them.
  244.             If you already have them, replace them with these.
  245.  
  246. void sb(int num, int colornum)
  247. {
  248.   int i;
  249.  
  250.   prt(colornum,"[");
  251.   ansic(1);
  252.   for (i=0;i<num;i++)
  253.     outchr(' ');
  254.   ansic(colornum);
  255.   outchr(']');
  256.   if (okansi())
  257.     npr("\x1b[%dD",num+1);
  258.   else
  259.     for (i=0;i<num+1;i++)
  260.       outchr('\b');
  261.   ansic(1);
  262. }
  263.  
  264. void cls()
  265. {
  266.   if (okansi())
  267.     outstr("\x1b[2J");    
  268.   else
  269.     outchr(12);
  270. }
  271.  
  272. void ansititle(char *str)
  273. {
  274.   int i,length,temp;
  275.  
  276.   if (okansi()) {
  277.     temp=curatr;
  278.     length=strlen(str);
  279.     length+=2;
  280.     for (i=0;i<length;i++)
  281.       npr("\x1b[1;37;40m▄");
  282.     nl();
  283.     npr("\x1b[0;31;47m %s ",str);
  284.     nl();
  285.     for (i=0;i<length;i++)
  286.       npr("\x1b[1;30;40m▀");
  287.     nl();
  288.     curatr=temp;
  289.   }
  290.   else
  291.     npr("%s",str);
  292. }
  293.  
  294. [ Step 4 ]: Save MISCCMD.C, and load up FCNS.H..    Go down to MISCCMD.C, at
  295.                         the end, and copy these lines in:
  296.                         (note: if you can MAKE FCNS do that instead..).
  297.  
  298. void sb(int num, int colornum);
  299. void cls();
  300. void ansititle(char *str);
  301.  
  302. [ Step 6 ]: Save FCNS.H, and start it compiling.. It won't take TOO long on a
  303.             286/386/486, 'cause it only needs to compile 1 file.. but if you
  304.             have an 8088 or something, go buy a new computer while it's
  305.             compiling. =|-]
  306.  
  307. If you like, and install this mod, or any of my mods, or if you feel the need
  308. to contact me for any reason, either call my board..
  309. The Fish Tank (703) 256-4117
  310. or E-Mail me at:
  311. WWIVLink 1@17306
  312. WWIVNet 1@7309
  313. IceNet 1@7309
  314. FishNet 193@5002
  315.  
  316.